package com.tuling.llmlangchain4j.config;

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.pinecone.PineconeEmbeddingStore;
import dev.langchain4j.store.embedding.pinecone.PineconeServerlessIndexConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.beans.BeanProperty;

import static java.util.UUID.randomUUID;

@Configuration
public class EmbeddingStoreConfig {

    @Bean
    public EmbeddingStore embeddingStore() {
        EmbeddingStore<TextSegment> embeddingStore = PineconeEmbeddingStore.builder()
                .apiKey(System.getenv("PINECONE_API_KEY"))
                .index("test")
                .nameSpace("test_01")
                .createIndex(PineconeServerlessIndexConfig.builder()
                        .cloud("AWS")
                        .region("us-east-1")
//                        .dimension(embeddingModel.dimension())
                        .build())
                .build();
        return  embeddingStore;
    }
}
